﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Configuration;

using SBPweb.Forge.Modules.Resources;
using SBPweb.Forge.Modules.Smartparts;

using SBPweb.Forge.Contracts.Components;

namespace SBPweb.Forge.Modules.Modularity
{
    /// <summary>
    /// Basic Interface for modules. It extends IPersistable and IDisposable
    /// </summary>
	public interface IModule : IPersistable, IDisposable, IInitializable
    {

        #region Property accessors

        /// <summary>
        /// Gets the Host of the application
        /// </summary>
        IModuleHost Host
        {
            get;
        }

        /// <summary>
        /// Gets the name of the module. it must be uniqe
        /// </summary>
        string Name
        {
            get;
        }

        /// <summary>
        /// Gets the full name of the Type of module
        /// </summary>
		string TypeName
		{
			get;
		}

        /// <summary>
        /// This flag should be true when module is initialized
        /// </summary>
        bool IsInitialized
        {
            get;
        }

        /// <summary>
        /// Gets or sets the visibility of the module
        /// </summary>
        bool IsVisible
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the Enable flag for module
        /// </summary>
        bool IsEnabled
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the ResourceHandler
        /// </summary>
        ResourceHandler Resources
        {
            get;
        }

        /// <summary>
        /// Gets the Smartparts of the module
        /// </summary>
        ISmartpart[] Smartparts
        {
            get;
        }

        /// <summary>
        /// Gets the ServiceDictionary.
        /// </summary>
        ServiceDictionary Services
        {
            get;
        }

		/// <summary>
		/// Gets the SessionDictionary
		/// </summary>
		SessionDictionary Session
		{
			get;
		}

        /// <summary>
        /// Gets the Version of the module
        /// </summary>
        System.Version Version
        {
            get;
        }

        /// <summary>
        /// Gets the FileVersion of the module
        /// </summary>
        System.Version AssemblyVersion
        {
            get;
        }

        /// <summary>
        /// Gets the Icon of the module
        /// </summary>
        Icon Icon
        {
            get;
        }

        /// <summary>
        /// Gets the Configuration of the module
        /// </summary>
        ApplicationSettingsBase Settings
        {
            get;
        }

		/// <summary>
		/// Capability of asynchronous Loading and initializing
		/// </summary>
		bool AsyncLoad
		{
			get;
		}

		/// <summary>
		/// Returns the module's configuration file as System.Configuration.Configuration
		/// </summary>
		System.Configuration.Configuration Configuration
		{
			get;
		}

        #endregion

        #region Public events

        /// <summary>
        /// VisibleChanged
        /// </summary>
        event EventHandler VisibleChanged;
        /// <summary>
        /// EnabledChanged
        /// </summary>
        event EventHandler EnabledChanged;

        #endregion

        #region Public methods

        /// <summary>
        /// Initialzes the module this method called by the ModuleLoader
        /// </summary>
        void Initialize();

        /// <summary>
        /// Terminatese the module this method called by the ModuleLoader
        /// </summary>
        void Terminate();

        #endregion

    }
}